<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        s = 'race a car'

        /**
         * @param {string} s
         * @param {string} t
         * @return {boolean}
         */
        var isAnagram = function(s, t) {
            var Obj = {}

            for (let i=0;i<s.length;i++){
                let n = s.charAt(i)
                if(Obj[n]){
                    Obj[n]++
                }else{
                    Obj[n] = 1
                }
            }
            for (let i=0;i<t.length;i++){
                let n = t.charAt(i)
                if(Obj[n]){
                    Obj[n]--
                }else{
                    Obj[n] = -1
                }
            }
            for(key in Obj){
                if(Obj[key]!=0){
                    return false
                }
            }
            return true
        };
        console.log(isPalindrome(s));

    </script>
</body>
</html>